<template>
  <div class="home">
    <div class="name">信息公告</div>
    <div class="center">
         <el-table :data="list" @row-click="goToDetails" >
      <el-table-column type="index" label="序号" width="55" align="center" />
      <el-table-column label="公告名称" align="center" prop="title" width="1000" />
      <el-table-column label="发布时间" align="center" prop="releaseTime">
        <template slot-scope="scope">
            <span style="margin-left: 10px">{{ scope.row.releaseTime }}</span>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      background
      layout="prev, pager, next"
      :total="total"
      :current-page.sync="currentPage"
      :page-size="pageSize"
      @current-change="getList"
      >
</el-pagination>
    </div>
  </div>
</template>

<script>
import {getListByPage} from '@/api/procurement/list'
export default {
data (){
    return{
        list:[],
        total: 0,
        pageSize: 10,
        currentPage: 1
    }
},
created () {
this.getList()
},
methods: {
// 获取列表页
getList(){
    getListByPage({
        pageIndex: this.currentPage,
        pageSize: this.pageSize,
        listType: 1
    }).then((res) =>{
        this.total = res.total,
        this.list = res.data
    })
},
// 跳转详情页
goToDetails(row){
 this.$router.push({
    name:'pingtaiDetails',
    query:{
        listId:row.listId
    }
 })
}
}
}
</script>

<style scoped>
.name{
    text-align: center;
    font-size: 30px;
    font-weight: 700;
    padding: 30px 0;
}
.el-pagination{
    float: right;
   margin: 30px 0;
}
.home {
    margin-bottom: 100px;
}
</style>